R/fetch functions.R

Defines functions collect_data_multi collect_data

collect_data_multi <- function(url_ls = abs_urls) {

  url_ls %>%
    walk(
      ~ download.file(.x$url, glue("{getwd()}/{.x$file_name}.xls"))
    )

  url_ls %>%
    map(
      ~ read_xls(glue("{getwd()}/{.x$file_name}.xls"), sheet = 2)
    )

}

#' @export

collect_data <- function(input) {

  download.file(input$url, glue("{getwd()}/data/{input$file_name}.xls"))

  read_xls(glue("{getwd()}/data/{input$file_name}.xls"), sheet = 2)

}
youngstreetinitiative/example documentation built on May 7, 2019, 1:31 p.m.